﻿<template>
  <a-modal
    title="编辑查询结算结果"
    :width="900"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleSubmit"
    @cancel="handleCancel">
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <a-form-item label="PSN_NO " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入PSN_NO " v-decorator="['psnNo']" />
        </a-form-item>
        <a-form-item label="操作员编号 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入操作员编号 " v-decorator="['operatorId']" />
        </a-form-item>
        <a-form-item label="操作员姓名 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入操作员姓名 " v-decorator="['operatorName']" />
        </a-form-item>
        <a-form-item label="终端编号 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入终端编号 " v-decorator="['termNo']" />
        </a-form-item>
        <a-form-item label="就诊凭证类型参考就诊凭证类型字典 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入就诊凭证类型参考就诊凭证类型字典 " v-decorator="['mdtrtCertType']" />
        </a-form-item>
        <a-form-item label="就诊凭证编号就诊凭证类型为“01”时填写电子凭证令牌，为“02”时填写身份证号，为“03”时填写社会保障卡卡号 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入就诊凭证编号就诊凭证类型为“01”时填写电子凭证令牌，为“02”时填写身份证号，为“03”时填写社会保障卡卡号 " v-decorator="['mdtrtCertNo']" />
        </a-form-item>
        <a-form-item label="机构系统跟踪号机构系统跟踪号，和拉取待结算时候返回的org_trace_no对应 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入机构系统跟踪号机构系统跟踪号，和拉取待结算时候返回的org_trace_no对应 " v-decorator="['orgTraceNo']" />
        </a-form-item>
        <a-form-item label="区域医保支付门户系统跟踪号区域医保支付门户系统跟踪号，机构需要保存此单号，后续可以通过这个进行退款 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入区域医保支付门户系统跟踪号区域医保支付门户系统跟踪号，机构需要保存此单号，后续可以通过这个进行退款 " v-decorator="['ampTraceId']" />
        </a-form-item>
        <a-form-item label="单据流水号单据流水号和查询待结算时候返回的doc_trace_no对应 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入单据流水号单据流水号和查询待结算时候返回的doc_trace_no对应 " v-decorator="['docTraceNo']" />
        </a-form-item>
        <a-form-item label="账户类型:01:门诊账户02:住院账户如果为空，则默认为门诊 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入账户类型:01:门诊账户02:住院账户如果为空，则默认为门诊 " v-decorator="['accountType']" />
        </a-form-item>
        <a-form-item label="费用总额费用总额 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入费用总额费用总额 " v-decorator="['feesumAmt']" />
        </a-form-item>
        <a-form-item label="充值金额用户通过“金融支付渠道”付费的金额 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入充值金额用户通过“金融支付渠道”付费的金额 " v-decorator="['depositAmount']" />
        </a-form-item>
        <a-form-item label="医院余额支付额用户使用医院余额支付金额 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入医院余额支付额用户使用医院余额支付金额 " v-decorator="['hospBalcPayAmt']" />
        </a-form-item>
        <a-form-item label="“充值方式”(金融支付渠道支付方式)参考“充值方式”字典 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入“充值方式”(金融支付渠道支付方式)参考“充值方式”字典 " v-decorator="['depositType']" />
        </a-form-item>
        <a-form-item label="渠道类型参考“渠道类型”字典 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入渠道类型参考“渠道类型”字典 " v-decorator="['channelType']" />
        </a-form-item>
        <a-form-item label="平台结算流水号平台结算流水号，机构要进行保存，后续退款和开展对账功能可以进行使用 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入平台结算流水号平台结算流水号，机构要进行保存，后续退款和开展对账功能可以进行使用 " v-decorator="['traceId']" />
        </a-form-item>
        <a-form-item label="机构编号(国标医院编码)机构的国家统一编码 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入机构编号(国标医院编码)机构的国家统一编码 " v-decorator="['orgCode']" />
        </a-form-item>
        <a-form-item label="实际使用的“患者费别”回写HIS实际用户线上结算所使用的费别" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入实际使用的“患者费别”回写HIS实际用户线上结算所使用的费别" v-decorator="['usedPatientType']" />
        </a-form-item>
        <a-form-item label="分院编号分机构编号，以用来区分分院或者基卫，如果为空则默认为本院该字典需由定点机构提供 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入分院编号分机构编号，以用来区分分院或者基卫，如果为空则默认为本院该字典需由定点机构提供 " v-decorator="['subOrgCode']" />
        </a-form-item>
        <a-form-item label="支付渠道订单号支付渠道所返回的支付渠道订单号 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入支付渠道订单号支付渠道所返回的支付渠道订单号 " v-decorator="['payChnlTraceNo']" />
        </a-form-item>
        <a-form-item label="商户订单号请求支付渠道时候所使用的商户订单号 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入商户订单号请求支付渠道时候所使用的商户订单号 " v-decorator="['mchTraceNo']" />
        </a-form-item>
        <a-form-item label="费用类型" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入费用类型" v-decorator="['feeType']" />
        </a-form-item>
        <a-form-item label="SETL_ID " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入SETL_ID " v-decorator="['setlId']" />
        </a-form-item>
        <a-form-item label="IPT_OTP_NO " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入IPT_OTP_NO " v-decorator="['iptOtpNo']" />
        </a-form-item>
        <a-form-item label="TRADE_STATUS " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入TRADE_STATUS " v-decorator="['tradeStatus']" />
        </a-form-item>
        <a-form-item v-show="false"><a-input v-decorator="['iD']" /></a-form-item>
      </a-form>
    </a-spin>
  </a-modal>
</template>

<script>
  import {
    NitfOrg003InputEdit
  } from '@/api/modular/main/NitfOrg003InputManage'
  export default {
    data () {
      return {
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 }
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 15 }
        },
        visible: false,
        confirmLoading: false,
        form: this.$form.createForm(this)
      }
    },
    methods: {
      // 初始化方法
      edit (record) {
        this.visible = true
        setTimeout(() => {
          this.form.setFieldsValue(
            {
              iD: record.iD,
              psnNo: record.psnNo,
              operatorId: record.operatorId,
              operatorName: record.operatorName,
              termNo: record.termNo,
              mdtrtCertType: record.mdtrtCertType,
              mdtrtCertNo: record.mdtrtCertNo,
              orgTraceNo: record.orgTraceNo,
              ampTraceId: record.ampTraceId,
              docTraceNo: record.docTraceNo,
              accountType: record.accountType,
              feesumAmt: record.feesumAmt,
              depositAmount: record.depositAmount,
              hospBalcPayAmt: record.hospBalcPayAmt,
              depositType: record.depositType,
              channelType: record.channelType,
              traceId: record.traceId,
              orgCode: record.orgCode,
              usedPatientType: record.usedPatientType,
              subOrgCode: record.subOrgCode,
              payChnlTraceNo: record.payChnlTraceNo,
              mchTraceNo: record.mchTraceNo,
              feeType: record.feeType,
              setlId: record.setlId,
              iptOtpNo: record.iptOtpNo,
              tradeStatus: record.tradeStatus
            }
          )
        }, 100)
      },
      handleSubmit () {
        const { form: { validateFields } } = this
        this.confirmLoading = true
        validateFields((errors, values) => {
          if (!errors) {
            for (const key in values) {
              if (typeof (values[key]) === 'object') {
                values[key] = JSON.stringify(values[key])
              }
            }
            NitfOrg003InputEdit(values).then((res) => {
              if (res.success) {
                this.$message.success('编辑成功')
                this.confirmLoading = false
                this.$emit('ok', values)
                this.handleCancel()
              } else {
                this.$message.error('编辑失败：' + JSON.stringify(res.message))
              }
            }).finally((res) => {
              this.confirmLoading = false
            })
          } else {
            this.confirmLoading = false
          }
        })
      },
      handleCancel () {
        this.form.resetFields()
        this.visible = false
      }
    }
  }
</script>
